<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div class="layui-fluid">

    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-card-header" style="color:#d02e25;font-family: '楷体'; ">
                举报个人
            </div>



        </div>
        <div class="layui-card-body">
            <table id="reportgrouplist" lay-filter="reportgrouplist"></table>
        </div>
    </div>


</div>


<script type="application/javascript"></script>

<script>
    layui.use(['table','form'], function(){
        var table = layui.table
            ,form = layui.form;

        //组织关系转接列表
        table.render({
            elem: '#reportgrouplist'
            // ,height: 'full-200'
            ,method: 'post'
            ,url: '/ajax/party/admin/reportgroup'
            ,page: true
            ,loading: true
            ,cellMinWidth: 80
            ,limit: 10
            ,id: 'reportgrouplist'
            ,cols: [[
                {field: 'id', title: 'ID', width: 80, sort: true, fixed: 'left'}
                ,{field: 'beReportedName', title: '被举报组织姓名',edit:'text',width: 100}
                ,{field: 'beReportedArea', title: '被举报组织区域',edit:'text'}
                ,{field: 'beReportedLevel', title: '被举报组织等级',edit:'text'}
                ,{field: 'reportName', title: '举报人姓名',edit:'text'}
                ,{field: 'reportTel', title: '举报人联系电话',edit:'text'}
                ,{fixed: 'right', title: '操作', align: 'center', width: 120, toolbar: '#dothing' }
            ]]
        });
        //监听工具条
        table.on('tool(reportgrouplist)', function(obj){
            var data = obj.data;

            if(obj.event === 'detail'){

                $.post('/ajax/party/admin/getOneRG',{
                    id:data.id
                },function(result){
                    layer.open({
                        type: 1,
                        area: ['800px','80%'],
                        title: "ID:" + data.id,
                        offset: '10%',
                        anim: 4,
                        shadeClose: true,
                        content: showdetails(result.data)
                    });
                    console.log(result);


                    });


            } else if(obj.event === 'del'){
                layer.confirm('真的删除行么', function(index){
                    $.post("/ajax/party/admin/delRG",{
                        id:data.id
                    },function(result){
                        console.log(result);
                        if(result.code==0){
                            layer.alert("删除成功！");
                        }
                        obj.del();
                        layer.close(index);
                    });
                });
            }
        });





    });
</script>

<script>
    function showdetails(data) {
        var s = '   <form class="layui-form" id="form1">\n' +
            '        <div class="layui-card">\n' +
            '            <div class="layui-card-header"  style="color:#d02e25;font-family: \'楷体\'; ">\n' +
            '                被举报组织信息\n' +
            '            </div>\n' +
            '            <div class="layui-card-body">\n' +
            '                <div class="layui-form-item">\n' +
            '                    <label class="layui-form-label">被举报组织名</label>\n' +
            '                    <div class="layui-input-inline">\n' +
            '                        <input type="text" name="beReportedName" value='+ data.beReportedName +' lay-verify="required"\n' +
            '                               autocomplete="off" class="layui-input">\n' +
            '                    </div>\n' +
            '\n' +
            '                    <label class="layui-form-label">被举报组织所在区域</label>\n' +
            '                    <div class="layui-input-inline">\n' +
            '                        <div class="layui-inline">\n' +
            '                            <input type="text" name="beReportedArea" value='+ data.beReportedArea +' lay-verify="required"\n' +
            '                                   autocomplete="off" class="layui-input">\n' +
            '                        </div>\n' +
            '                    </div>\n' +
            '                </div>\n' +
            '\n' +
            '                <div class="layui-form-item">\n' +
            '                    <label class="layui-form-label">被举报组织等级</label>\n' +
            '                    <div class="layui-input-inline">\n' +
            '                        <input type="text" name="beReportedLevel" value='+ data.beReportedLevel +' lay-verify="required"\n' +
            '                               autocomplete="off" class="layui-input">\n' +
            '                    </div>\n' +
            '\n' +
            '                    <label class="layui-form-label">被举报组织主要问题</label>\n' +
            '                    <div class="layui-input-inline">\n' +
            '                        <div class="layui-inline">\n' +
            '                            <textarea name="beReportedImproblem"  lay-verify="required"placeholder="" class="layui-textarea">'+ data.beReportedImproblem +'</textarea>\n' +
            '                        </div>\n' +
            '                    </div>\n' +
            '                </div>\n' +
            '\n' +
            '                <div class="layui-card-header"  style="color:#d02e25;font-family: \'楷体\'; ">\n' +
            '                    举报人信息\n' +
            '                </div>\n' +
            '\n' +
            '                <div class="layui-form-item">\n' +
            '                    <label class="layui-form-label">举报人姓名</label>\n' +
            '                    <div class="layui-input-inline">\n' +
            '                        <input type="text" name="reportName" value='+ data.reportName +' lay-verify="required"\n' +
            '                               autocomplete="off" class="layui-input">\n' +
            '                    </div>\n' +
            '\n' +
            '                    <label class="layui-form-label">举报人性别</label>\n' +
            '                    <div class="layui-input-inline">\n' +
            '                        <div class="layui-inline">\n' +
            '                            <input type="text" name="reportSex" value='+ data.reportSex +' lay-verify="required"\n' +
            '                                   autocomplete="off" class="layui-input">\n' +
            '                        </div>\n' +
            '                    </div>\n' +
            '                </div>\n' +
            '\n' +
            '                <div class="layui-form-item">\n' +
            '                    <label class="layui-form-label">举报人政治面貌</label>\n' +
            '                    <div class="layui-input-inline">\n' +
            '                        <input type="text" name="reportPolitical" value='+ data.reportPolitical +' lay-verify="required"\n' +
            '                               autocomplete="off" class="layui-input">\n' +
            '                    </div>\n' +
            '\n' +
            '                    <label class="layui-form-label">举报人身份证</label>\n' +
            '                    <div class="layui-input-inline">\n' +
            '                        <div class="layui-inline">\n' +
            '                            <input type="text" name="reportIdcard" value='+ data.reportIdcard +' lay-verify="required"\n' +
            '                                   autocomplete="off" class="layui-input">\n' +
            '                        </div>\n' +
            '                    </div>\n' +
            '                </div>\n' +
            '\n' +
            '                <div class="layui-form-item">\n' +
            '                    <label class="layui-form-label">举报人联系电话</label>\n' +
            '                    <div class="layui-input-inline">\n' +
            '                        <input type="text" name="reportTel" value='+ data.reportTel +' lay-verify="required"\n' +
            '                               autocomplete="off" class="layui-input">\n' +
            '                    </div>\n' +
            '\n' +
            '                    <label class="layui-form-label">举报人地址</label>\n' +
            '                    <div class="layui-input-inline">\n' +
            '                        <div class="layui-inline">\n' +
            '                            <input type="text" name="reportAddress" value='+ data.reportAddress +' lay-verify="required"\n' +
            '                                   autocomplete="off" class="layui-input">\n' +
            '                        </div>\n' +
            '                    </div>\n' +
            '                </div>\n' +
            '\n' +
            '                <div class="layui-form-item">\n' +
            '                    <label class="layui-form-label">举报人邮箱</label>\n' +
            '                    <div class="layui-input-inline">\n' +
            '                        <input type="text" name="reportMail" value='+ data.reportMail +' lay-verify="required"\n' +
            '                               autocomplete="off" class="layui-input">\n' +
            '                    </div>\n' +
            '\n' +
            '                    <label class="layui-form-label">提交时间</label>\n' +
            '                    <div class="layui-input-inline">\n' +
            '                        <div class="layui-inline">\n' +
            '                            <input type="text" name="updateTime" value='+ data.updateTime +' lay-verify="required"\n' +
            '                                   autocomplete="off" class="layui-input">\n' +
            '                        </div>\n' +
            '                    </div>\n' +
            '                </div>\n' +
            '\n' +
            '            </div>\n' +
            '        </div>\n' +
            '    </form>';

        return s;
    }


</script>


<script type="text/html" id="dothing">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>

    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>

